package com.azusa.xbjy.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.*;
import java.util.Date;

@Entity
@Table(name = "meeting")
public class Meeting {
    private int id;
    private String deptName;
    private Integer deptId;
    private String title;
    private String content;
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm ss")
    private Date publishDate;

    @JsonFormat(pattern = "yyyy-MM-dd hh:mm ss")
    private Date startTime;

    @JsonFormat(pattern = "yyyy-MM-dd hh:mm ss")
    private Date endTime;
    private int status;
    private String makeUser;

    @Id
    @Column(name = "id", table = "meeting", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "dept_name", table = "meeting", nullable = true, length = 50)
    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    @Basic
    @Column(name = "title", table = "meeting", nullable = true, length = 50)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    @Basic
    @Column(name = "content", table = "meeting", nullable = true, length = 255)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Basic
    @Column(name = "publish_date", table = "meeting", nullable = true)
    public Date getPublishDate() {
        return publishDate;
    }

    public void setPublishDate(Date publishDate) {
        this.publishDate = publishDate;
    }

    @Basic
    @Column(name = "start_time", table = "meeting", nullable = true)
    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    @Basic
    @Column(name = "end_time", table = "meeting", nullable = true)
    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    @Basic
    @Column(name = "status", table = "meeting", nullable = false)
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Basic
    @Column(name = "make_user", table = "meeting", nullable = true, length = 100)
    public String getMakeUser() {
        return makeUser;
    }

    public void setMakeUser(String makeUser) {
        this.makeUser = makeUser;
    }

    @Basic
    @Column(name = "dept_id", table = "meeting", nullable = false)
    public Integer getDeptId() {
        return deptId;
    }

    public void setDeptId(Integer deptId) {
        this.deptId = deptId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Meeting meeting = (Meeting) o;

        if (id != meeting.id) return false;
        if (status != meeting.status) return false;
        if (deptName != null ? !deptName.equals(meeting.deptName) : meeting.deptName != null) return false;
        if (deptId != null ? !deptId.equals(meeting.deptId) : meeting.deptId != null) return false;
        if (title != null ? !title.equals(meeting.title) : meeting.title != null) return false;
        if (content != null ? !content.equals(meeting.content) : meeting.content != null) return false;
        if (publishDate != null ? !publishDate.equals(meeting.publishDate) : meeting.publishDate != null) return false;
        if (startTime != null ? !startTime.equals(meeting.startTime) : meeting.startTime != null) return false;
        if (endTime != null ? !endTime.equals(meeting.endTime) : meeting.endTime != null) return false;
        return makeUser != null ? makeUser.equals(meeting.makeUser) : meeting.makeUser == null;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (deptName != null ? deptName.hashCode() : 0);
        result = 31 * result + (deptId != null ? deptId.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (publishDate != null ? publishDate.hashCode() : 0);
        result = 31 * result + (startTime != null ? startTime.hashCode() : 0);
        result = 31 * result + (endTime != null ? endTime.hashCode() : 0);
        result = 31 * result + status;
        result = 31 * result + (makeUser != null ? makeUser.hashCode() : 0);
        return result;
    }
}
